# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2LabelPermission do
  @moduledoc """
  The permission that applies to a principal (user, group, audience) on a label.

  ## Attributes

  *   `audience` (*type:* `String.t`, *default:* `nil`) - Audience to grant a role to. The magic value of `audiences/default` may be used to apply the role to the default audience in the context of the organization that owns the Label.
  *   `email` (*type:* `String.t`, *default:* `nil`) - Specifies the email address for a user or group pricinpal. Not populated for audience principals. User and Group permissions may only be inserted using email address. On update requests, if email address is specified, no principal should be specified.
  *   `group` (*type:* `String.t`, *default:* `nil`) - Group resource name.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Resource name of this permission.
  *   `person` (*type:* `String.t`, *default:* `nil`) - Person resource name.
  *   `role` (*type:* `String.t`, *default:* `nil`) - The role the principal should have.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :audience => String.t() | nil,
          :email => String.t() | nil,
          :group => String.t() | nil,
          :name => String.t() | nil,
          :person => String.t() | nil,
          :role => String.t() | nil
        }

  field(:audience)
  field(:email)
  field(:group)
  field(:name)
  field(:person)
  field(:role)
end

defimpl Poison.Decoder, for: GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2LabelPermission do
  def decode(value, options) do
    GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2LabelPermission.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DriveLabels.V2.Model.GoogleAppsDriveLabelsV2LabelPermission do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
